import request from '@/utils/request'


///////商家记录表

export function getCards(params) {
  return request({
    url: '/cards/card/',
    method: 'GET',
    params
  })
}

export function getAllCards(params) {
  return request({
    url: '/cards/card_list/',
    method: 'GET',
    params
  })
}

export function addCard(data) {
  return request({
    url: '/cards/card/',
    method: 'POST',
    data
  })
}

export function updateCard(data) {
  return request({
    url: `/cards/card/${data.id}/`,
    method: 'PUT',
    data
  })
}

export function delCard(id) {
  return request({
    url: `/cards/card/${id}/`,
    method: 'DELETE',
  })
}

export function delCards(data) {
  return request({
    url: '/cards/card/batch_delete',
    method: 'DELETE',
    data
  })
}

export function delCardImage(card_id) {
  return request({
    url: `/cards/image_del/${card_id}/`,
    method: 'POST',
  })
}

///////商家会员卡

export function getRetailerCards(params) {
  return request({
    url: '/cards/retailer_card/',
    method: 'GET',
    params
  })
}

export function getAllRetailerCards(params) {
  return request({
    url: '/cards/retailer_card_list/',
    method: 'GET',
    params
  })
}

export function addRetailerCard(data) {
  return request({
    url: '/cards/retailer_card/',
    method: 'POST',
    data
  })
}

export function updateRetailerCard(data) {
  return request({
    url: `/cards/retailer_card/${data.id}/`,
    method: 'PUT',
    data
  })
}

export function delRetailerCard(id) {
  return request({
    url: `/cards/retailer_card/${id}/`,
    method: 'DELETE',
  })
}

export function delRetailerCards(data) {
  return request({
    url: '/cards/retailer_card/batch_delete/',
    method: 'DELETE',
    data
  })
}

//商家购买会员卡
export function getCardDeposits(params) {
  return request({
    url: '/cards/card_deposit/',
    method: 'GET',
    params
  })
}

export function addCardDeposit(data) {
  return request({
    url: '/cards/card_deposit/',
    method: 'POST',
    data
  })
}

export function updateCardDeposit(data) {
  return request({
    url: `/cards/card_deposit/${data.id}/`,
    method: 'PUT',
    data
  })
}

export function delCardDeposit(id) {
  return request({
    url: `/cards/card_deposit/${id}/`,
    method: 'DELETE',
  })
}

export function delCardDeposits(data) {
  return request({
    url: '/cards/card_deposit/batch_delete',
    method: 'DELETE',
    data
  })
}

///////商家赠送卡记录

export function getGiftCards(params) {
  return request({
    url: '/cards/gift_card/',
    method: 'GET',
    params
  })
}

export function addGiftCard(data) {
  return request({
    url: '/cards/gift_card/',
    method: 'POST',
    data
  })
}

export function updateGiftCard(data) {
  return request({
    url: `/cards/gift_card/${data.id}/`,
    method: 'PUT',
    data
  })
}

export function delGiftCard(id) {
  return request({
    url: `/cards/gift_card/${id}/`,
    method: 'DELETE',
  })
}

export function delGiftCards(data) {
  return request({
    url: '/cards/gift_card/batch_delete',
    method: 'DELETE',
    data
  })
}

///////客户品鉴卡信息

export function getSampleCards(params) {
  return request({
    url: '/cards/sample_card/',
    method: 'GET',
    params
  })
}

// export function addSampleCard(data) {
//   return request({
//     url: '/cards/sample_card/',
//     method: 'POST',
//     data
//   })
// }

// export function updateSampleCard(data) {
//   return request({
//     url: `/cards/sample_card/${data.id}/`,
//     method: 'PUT',
//     data
//   })
// }

export function delSampleCard(id) {
  return request({
    url: `/cards/sample_card/${id}/`,
    method: 'DELETE',
  })
}

export function delSampleCards(data) {
  return request({
    url: '/cards/sample_card/batch_delete/',
    method: 'DELETE',
    data
  })
}

///////客户品鉴卡消费信息

export function getClientSampleRecords(params) {
  return request({
    url: '/cards/client_sample_record/',
    method: 'GET',
    params
  })
}


export function delClientSampleRecord(id) {
  return request({
    url: `/cards/client_sample_record/${id}/`,
    method: 'DELETE',
  })
}

export function delClientSampleRecords(data) {
  return request({
    url: '/cards/client_sample_record/batch_delete/',
    method: 'DELETE',
    data
  })
}

///////结算记录信息

export function getBalanceBills(params) {
  return request({
    url: '/cards/balance_bill/',
    method: 'GET',
    params
  })
}


export function delBalanceBill(id) {
  return request({
    url: `/cards/balance_bill/${id}/`,
    method: 'DELETE',
  })
}

export function delBalanceBills(data) {
  return request({
    url: '/cards/balance_bill/batch_delete/',
    method: 'DELETE',
    data
  })
}